# 图片序列化器
from rest_framework import serializers
from apps.goods.models import SKUImage
from apps.goods.models import SKU


class ImageSerializer(serializers.ModelSerializer):
    # 返回图片关联的sku的id值
    # sku = serializers.PrimaryKeyRelatedField(read_only=True)

    class Meta:
        model = SKUImage
        fields = ['id', 'sku', 'image']


class SKUSeriazlier(serializers.ModelSerializer):
    class Meta:
        model = SKU
        fields = ('id', 'name')
